/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright (c) 2013-2014 jfinal app. jfapp Group.
 */

package app.controllers.mobileweb;

import app.interceptors.MobileWxMemberInterceptor;
import app.models.movie.Movie;
import com.github.sog.controller.BasicController;
import com.jfinal.aop.Before;

import java.util.List;

/**
 * Created by devil
 * 影迷天下
 */
@Before(MobileWxMemberInterceptor.class)
public class MovieFanController extends BasicController {

    /**
     * 电影列表
     */
    public void index() {
        String movieType = "newest";
        String param = getPara("movietype");
        if (param == null || param == "") {
            movieType = param;
        }

        List<Movie> list = Movie.dao.find("select * from ol_movice where category= ?", movieType);
        setAttr("movieList", list);
        render("moviefan.ftl");
    }

    /**
     * 电影详情
     */
    public void showmovie() {
        int movieId = 0;
        String param = getPara("movieid");
        if (param == null || param == "") {
            movieId = int.class.cast(param);
        }

        Movie item = Movie.dao.findById(movieId);
        setAttr("movie", item);
        render("showmovie.ftl");
    }
}
